package org.JWCB.job.mapper.user;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.JWCB.job.domain.user.UserScore;
import org.JWCB.job.domain.user.UserSubmit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

@Mapper
public interface UserSubmitMapper extends BaseMapper<UserSubmit> {
    List<Long> selectHotQuestionIds(Integer limit);

    List<UserScore> selectUserScoreList(Set<Long> examIdSet);

    /**
     * 获取题目的提交次数
     * 
     * @param questionId 题目ID
     * @return 提交次数
     */
    @Select("SELECT COUNT(*) FROM tb_user_submit WHERE question_id = #{questionId} AND exam_id IS NULL")
    Integer selectSubmitCountByQuestionId(Long questionId);
}
